import Vue from 'vue'
import App from './App.vue'
import './registerServiceWorker'
import router from './router'
import store from './store'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import vuetify from '@/plugins/vuetify' // path to vuetify export
import axios from "axios";
import * as echarts from 'echarts';
import qs from 'qs'
import animated from 'animate.css' // npm install animate.css --save安装，在引入

Vue.config.productionTip = false
Vue.use(ElementUI)
Vue.use(animated)

// 设置基础URL为后端服务api地址
// axios.defaults.baseURL = "http://www.littlepig.xyz:9220" //宿舍ip
// axios.defaults.baseURL = "http://192.168.31.221:9220" //宿舍ip
// axios.defaults.baseURL = "http://localhost:9220"
axios.defaults.baseURL = "http://192.168.39.218:9220"

//设置全局，每次ajax请求携带cookies
axios.defaults.withCredentials = true
//解决post没有参数的问题
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'


axios.create({
  headers: {'Content-Type': 'application/json;charset=utf-8'},// 设置传输内容的类型和编码
  withCredentials: true,// 指定某个请求应该发送凭据。允许客户端携带跨域cookie，也需要此配置
});

// 设置csrf请求头
axios.defaults.xsrfCookieName = 'XSRF-TOKEN'
axios.defaults.xsrfHeaderName = 'X-XSRF-TOKEN'

// 将API方法绑定到全局
Vue.prototype.$axios = axios
Vue.prototype.$qs = qs
Vue.prototype.$echarts = echarts

new Vue({
  router,
  store,
  vuetify,
  render: h => h(App)
}).$mount('#app')

